/**
 * 环境配置
 */

// 获取当前环境
const getEnvironment = () => {
  const env = import.meta.env.MODE || 'development'
  return env
}

// 环境配置
const configs = {
  // 开发环境
  development: {
    API_BASE_URL: 'http://localhost:8080/api',
    UPLOAD_BASE_URL: 'http://localhost:8080/uploads'
  },
  // 生产环境
  production: {
    // 使用相对路径，通过Nginx代理访问后端
    API_BASE_URL: '/api',
    UPLOAD_BASE_URL: '/uploads'
  },
  // 测试环境
  test: {
    API_BASE_URL: 'http://test-server:8080/api',
    UPLOAD_BASE_URL: 'http://test-server:8080/uploads'
  }
}

// 获取当前环境配置
const getConfig = () => {
  const env = getEnvironment()
  return configs[env] || configs.development
}

export default {
  ...getConfig(),
  environment: getEnvironment()
}